package priv.pront.code.national.acwing.search.dfs;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-05-27 22:09
 */
public class Acwing1112_迷宫 {

    static int N = 110, row, col;
    static BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
    static char[][] a = new char[N][N];
    static int[][] dir = new int[][]{{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
    public static void main(String[] args) throws Exception{
        int t = Integer.valueOf(read.readLine());
        while(t-- > 0){
            int n = Integer.valueOf(read.readLine());
            row = col = n;
            for(int i = 0; i < n; i++){
                String s = read.readLine();
                for(int j = 0; j < n; j++){
                    a[i][j] = s.charAt(j);
                }
            }
            String[] ss = read.readLine().split(" ");
            int x1 = Integer.valueOf(ss[0]);
            int y1 = Integer.valueOf(ss[1]);
            int x2 = Integer.valueOf(ss[2]);
            int y2 = Integer.valueOf(ss[3]);
            boolean[][] st = new boolean[n][n];
            if(a[x1][y1] == '#' || a[x2][y2] == '#'){
                System.out.println("NO");
            }else if(x1 == x2 && y1 == y2){
                System.out.println("YES");
            }else if(dfs(x1, y1, x2, y2, st)){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }

        }
    }

    public static boolean dfs(int x1, int y1, int x2, int y2, boolean[][] st){
        for(int i = 0; i < 4; i++){
            int nx = x1 + dir[i][0];
            int ny = y1 + dir[i][1];
            if(nx < 0 || nx >= row || ny < 0 || ny >= col) continue;
            if(st[nx][ny] || a[nx][ny] == '#') continue;
            st[nx][ny] = true;
            if(nx == x2 && ny == y2) return true;
            if(dfs(nx, ny, x2, y2, st)) return true;
        }
        return false;
    }
}
